package cn.skycity.common.service.impl;

import cn.skycity.common.mapper.SysUserRoleMapper;
import cn.skycity.common.service.ISysUserRoleService;
import cn.skycity.framework.core.utils.StreamUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.skycity.framework.uaa.pojo.entity.SysRole;
import com.skycity.framework.uaa.pojo.entity.SysUserRole;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements ISysUserRoleService {

    @Override
    public List<Long> listRoleIdByUserId(Long userId) {
        List<SysRole> sysRoles = baseMapper.selectRoleIdsByUserId(userId);
        return StreamUtils.toList(sysRoles, SysRole::getId);
    }
}
